package com.tjsinfo.tjsoa.reminded.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONObject;

import com.tjsinfo.tjsoa.common.SessionUser;
import com.tjsinfo.tjsoa.reminded.vo.TSystemReminded;
import com.tjsinfo.tjsoa.reminded.bo.TSystemRemindedManager;
import com.tjsinfo.tjsoa.system.vo.User;

public class RemindedDaiBanAction extends Action {
	TSystemRemindedManager systemRemindedManager;
	
	public TSystemRemindedManager getSystemRemindedManager() {
		return systemRemindedManager;
	}

	public void setSystemRemindedManager(
			TSystemRemindedManager systemRemindedManager) {
		this.systemRemindedManager = systemRemindedManager;
	}

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
	        throws Exception {
		String userid =  String.valueOf(SessionUser.getUser(request).getUser_id());
		String loginname =  String.valueOf(SessionUser.getUser(request).getUsername());
		
		//收到提醒
		List<TSystemReminded> relist=systemRemindedManager.findByRemind("idList", "%,"+userid+",%","memo", "%,"+loginname+"%");
		JSONObject object = new JSONObject();
    	object.put("remind", relist.size());
    	response.getWriter().print(object);
		return null;
	}
}
